<?php
echo $this->loadJs();
echo $this->loadCss();
echo $this->headScript()->appendFile($this->baseUrl() . "/js/admin/vm/vm.js");
?>
<input type="hidden" id="codigo_vm" value="<?php echo $this->codigo_vm; ?>"/>
<input type="hidden" id="codigo_maquina_virtual" value="<?php echo $this->codigo_maquina_virtual; ?>"/>
<h3><?php echo $this->displayname; ?></h3>
<div id="vm" class="row-fluid">
    <div class="span4">
        <div class="row-fluid">
            <img src="<?php echo $this->baseUrl() . "/images/computer.jpg" ?>" id="avatar" class="img-polaroid"/>
        </div>
        <br/>
        <div class="row-fluid">
            <?php
            if ($this->state == VirtualLabs_Admin_Machine::ESTADO_ENCENDIDO) {
                echo "<a target=\"_blank\" onclick=\"window.open(this.href, 'mywin', 'width=800,height=800,fullscreen=1,scrollbars=1,toolbar=0,resizable=1');
                    return false;\" href=" . $this->url(array('module' => 'admin', 'controller' => 'virtualmachine', 'action' => 'managevm', 'port' => $this->port, 'hostname' => $this->hostName)) . ">" . "<button id=\"btn-conectar\" class=\"btn btn-small btn-info\"><i class=\"icon-retweet icon-white\"></i> Conectar</button>" . "</a>";
                echo '<button id="btn-apagar" class="btn btn-small btn-danger"><i class="icon-off icon-white"></i> Apagar</button>';
                echo '<button id="btn-encender" class="btn btn-small btn-success disabled"><i class="icon-ok icon-white" disabled></i> Encender</button>';
            } else {
                echo '<button id="btn-conectar" class="btn btn-small btn-info disabled"><i class="icon-retweet icon-white" disabled></i> Conectar</button>';
                echo '<button id="btn-apagar" class="btn btn-small btn-danger disabled"><i class="icon-off icon-white" disabled></i> Apagar</button>';
                echo '<button id="btn-encender" class="btn btn-small btn-success"><i class="icon-ok icon-white"></i> Encender</button>';
            }
            ?>

        </div>
    </div>
    <div class="span8">
        <div class="tabbable">
            <ul class="nav nav-tabs">
                <li class="active">
                    <a  data-toggle="tab" href="#laboratorio-tab">Datos Generales</a>
                </li>
                <li>
                    <a data-toggle="tab" href="#hw-tab">Hardware</a>
                </li>
                <li>
                    <a data-toggle="tab"  href="#net-tab">Red - <?php echo $this->networkName; ?></a>
                </li>
                <li>
                    <a data-toggle="tab" href="#pe-tab">Perfil de encendido</a>
                </li>
            </ul>
        </div>
        <div class="tab-content">
            <div class="tab-pane active" id="laboratorio-tab">
                <div class="row-fluid">
                    <div class="span4">
                        <strong>Laboratorio :</strong>
                        <?php echo "<a href='" . $this->baseUrl() . "/admin/laboratorio/edit/id/" . $this->codigoLaboratorio . "'>" . $this->nombreLaboratorio . "</a>"; ?>
                    </div>
                </div>
                <div class="row-fluid">
                    <div class="span4">
                        <strong>Alumnos Asignados</strong>                    
                    </div>
                </div>
                <div class="row-fluid">
                    <div class="span4">
                        <ul id="ul-assign">                            
                        </ul>
                    </div>
                </div>
                <div class="row-fluid">
                    <div class="span4">
                        <button id='btn-asignar' class='btn btn-small btn-success' onclick="assign(<?php echo $this->codigo_maquina_virtual;?>);"> <strong>Asignar Alumnos ...</strong></button>
                    </div>
                </div>
            </div>        
            <div class="tab-pane" id="hw-tab">
                <p><b>CPU:</b> <?php echo $this->cpuNumber; ?> de <?php echo $this->cpuSpeed; ?> MHz</p>
                <p><b>Memoria:</b> <?php echo $this->memory; ?> MB</p>
            </div>
            <div class="tab-pane" id="net-tab">
                <div class="row-fluid">
                    <p><b>IP:</b> <?php echo $this->ip; ?></p>
                    <p><b>M&aacute;scara:</b> <?php echo $this->netmask; ?></p>
                    <p><b>GW:</b> <?php echo $this->gateway; ?></p>
                </div>
            </div>
            <div class="tab-pane" id="pe-tab">
                <div class="row-fluid">
                    <p><b>D&iacute;as de la semana:</b> <?php echo $this->dias; ?> </p>
                    <p><b>Hora inicio diario:</b> <?php echo $this->horaInicioDia; ?> </p>
                    <p><b>Hora fin diario:</b> <?php echo $this->horaInicioDia; ?> </p>
                    <p><b>Horas diarias:</b> <?php echo $this->horasDiarias; ?> </p>
                    <p><b>Horas curso:</b> <?php echo $this->horasCurso; ?> </p>
                    <p><b>Permite fuera de horario:</b> <?php echo $this->fueraHorario; ?> </p>
                </div>
            </div>
        </div>
    </div>
</div>
<!--<div class="row-fluid">
    <a href="<?php echo $this->url(array('module' => 'admin', 'controller' => 'virtualmachine', 'action' => 'lab', 'laboratorio' => $this->codigoLaboratorio)); ?>" class="btn btn-inverse btn-small">Volver</a>
</div>-->